24 #define foreach(x, v) for (typeof (v).begin() x=(v).begin(); x !=(v).end(); ++x)
25 #define For(i, a, b) for (int i=(a); i<(b); ++i)
26 #define D(x) cout << #x " is " << x << endl
28 const double EPS
= 1e-9;
29 int cmp(double x
, double y
= 0, double tol
= EPS
) {
30 return (x
<= y
+ tol
) ? (x
+ tol
< y
) ? -1 : 0 : 1;
33 const int MAXN
= 100005 * 2;
42 while (getline(cin
, s
)) {
45 reverse(t
.begin(), t
.begin() + n
);
48 for (int i
= 1; i
< 2 * n
+ 1; ++i
) {
50 while (p
[i
] > 0 and t
[i
] != t
[p
[i
]]) p
[i
] = p
[p
[i
] - 1];
51 if (t
[i
] == t
[p
[i
]]) p
[i
]++;
56 // for (int i = 0; i < 2 * n + 1; ++i) {
57 // printf("%d ", p[i]);
61 printf("%s", s
.c_str());
62 for (int i
= 0; i
<= n
; ++i
) {
63 if (2 * i
- n
>= 0 and p
[n
+ i
] >= n
- i
) {
64 //printf("i = %d works on the first case\n", i);
65 for (int k
= 2 * i
- n
- 1; k
>= 0; --k
) {
71 if (i
< n
and 2 * i
- n
+ 1 >= 0 and p
[n
+ i
+ 1] >= n
- i
) {
72 for (int k
= 2 * i
- n
; k
>= 0; --k
) {